home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / CursorDevices.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  8.8 KB  |  288 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        CursorDevices.a
  3. ;
  4. ;    Contains:    Cursor Devices (mouse/trackball/etc) Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__CURSORDEVICES__') = 'UNDEFINED' THEN
  18. __CURSORDEVICES__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  24.     include 'MixedMode.a'
  25.     ENDIF
  26.  
  27. ;                        * * *  I M P O R T A N T  * * * 
  28. ;
  29. ;            You will need CursorDevicesGlue.o to use CDM from PowerPC
  30. ;
  31. ;
  32. ;    In order to use the Cursor Devices Manager (CDM) on PowerPC systems, you must 
  33. ;    link with the file CursorDevicesGlue.o and InterfaceLib 1.1.3.  This is necessary
  34. ;    because the original MixedMode transition code for CDM in InterfaceLib in ROM
  35. ;    was wrong.  The code in CursorDevicesGlue.o will check to see if the ROM has
  36. ;    been fixed and calls through to it if so.  If it detects that the ROM has not
  37. ;    been fixed, it uses its own implementation of the CDM MixedMode transition 
  38. ;    routines. 
  39. ;    
  40. ;
  41.  
  42.  
  43. ; typedef short                         ButtonOpcode
  44.  
  45. ;  ButtonOpcodes 
  46.  
  47. kButtonNoOp                        EQU        0                    ; No action for this button 
  48. kButtonSingleClick                EQU        1                    ; Normal mouse button 
  49. kButtonDoubleClick                EQU        2                    ; Click-release-click when pressed 
  50. kButtonClickLock                EQU        3                    ; Click on press, release on next press 
  51.  
  52. kButtonCustom                    EQU        6                    ; Custom behavior, data = CursorDeviceCustomButtonUPP 
  53. ;  Device Classes 
  54.  
  55. kDeviceClassAbsolute            EQU        0                    ; a flat-response device 
  56. kDeviceClassMouse                EQU        1                    ; mechanical or optical mouse 
  57. kDeviceClassTrackball            EQU        2                    ; trackball 
  58. kDeviceClassTrackPad            EQU        3
  59.  
  60. kDeviceClass3D                    EQU        6                    ; a 3D pointing device 
  61. ;  Structures used in Cursor Device Manager calls 
  62. CursorData                RECORD 0
  63. nextCursorData             ds.l    1                ; offset: $0 (0)        ;  next in global list 
  64. displayInfo                 ds.l    1                ; offset: $4 (4)        ;  unused (reserved for future) 
  65. whereX                     ds.l    1                ; offset: $8 (8)        ;  horizontal position 
  66. whereY                     ds.l    1                ; offset: $C (12)        ;  vertical position 
  67. where                     ds        Point            ; offset: $10 (16)        ;  the pixel position 
  68. isAbs                     ds.b    1                ; offset: $14 (20)        ;  has been stuffed with absolute coords 
  69. buttonCount                 ds.b    1                ; offset: $15 (21)        ;  number of buttons currently pressed 
  70. screenRes                 ds.l    1                ; offset: $16 (22)        ;  pixels per inch on the current display 
  71. privateFields             ds.w    22                ; offset: $1A (26)        ;  fields use internally by CDM 
  72. sizeof                     EQU *                    ; size:   $46 (70)
  73.                         ENDR
  74. ; typedef struct CursorData *            CursorDataPtr
  75.  
  76. CursorDevice            RECORD 0
  77. nextCursorDevice         ds.l    1                ; offset: $0 (0)        ;  pointer to next record in linked list 
  78. whichCursor                 ds.l    1                ; offset: $4 (4)        ;  pointer to data for target cursor 
  79. refCon                     ds.l    1                ; offset: $8 (8)        ;  application-defined 
  80. unused                     ds.l    1                ; offset: $C (12)        ;  reserved for future 
  81. devID                     ds.l    1                ; offset: $10 (16)        ;  device identifier (from ADB reg 1) 
  82. resolution                 ds.l    1                ; offset: $14 (20)        ;  units/inch (orig. from ADB reg 1) 
  83. devClass                 ds.b    1                ; offset: $18 (24)        ;  device class (from ADB reg 1) 
  84. cntButtons                 ds.b    1                ; offset: $19 (25)        ;  number of buttons (from ADB reg 1) 
  85. filler1                     ds.b    1                ; offset: $1A (26)        ;  reserved for future 
  86. buttons                     ds.b    1                ; offset: $1B (27)        ;  state of all buttons 
  87. buttonOp                 ds.b    8                ; offset: $1C (28)        ;  action performed per button 
  88. buttonTicks                 ds.l    8                ; offset: $24 (36)        ;  ticks when button last went up (for debounce) 
  89. buttonData                 ds.l    8                ; offset: $44 (68)        ;  data for the button operation 
  90. doubleClickTime             ds.l    1                ; offset: $64 (100)        ;  device-specific double click speed 
  91. acceleration             ds.l    1                ; offset: $68 (104)        ;  current acceleration 
  92. privateFields             ds.w    15                ; offset: $6C (108)        ;  fields used internally to CDM 
  93. sizeof                     EQU *                    ; size:   $8A (138)
  94.                         ENDR
  95. ; typedef struct CursorDevice *            CursorDevicePtr
  96.  
  97. ;  for use with CursorDeviceButtonOp when opcode = kButtonCustom 
  98. ;
  99. ; pascal OSErr CursorDeviceMove(CursorDevicePtr ourDevice, long deltaX, long deltaY)
  100. ;
  101.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  102.         Macro
  103.         _CursorDeviceMove
  104.             moveq               #0,D0
  105.             dc.w                $AADB
  106.         EndM
  107.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  108.         IMPORT_CFM_FUNCTION CursorDeviceMove
  109.     ENDIF
  110.  
  111. ;
  112. ; pascal OSErr CursorDeviceMoveTo(CursorDevicePtr ourDevice, long absX, long absY)
  113. ;
  114.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  115.         Macro
  116.         _CursorDeviceMoveTo
  117.             moveq               #1,D0
  118.             dc.w                $AADB
  119.         EndM
  120.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  121.         IMPORT_CFM_FUNCTION CursorDeviceMoveTo
  122.     ENDIF
  123.  
  124. ;
  125. ; pascal OSErr CursorDeviceFlush(CursorDevicePtr ourDevice)
  126. ;
  127.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  128.         Macro
  129.         _CursorDeviceFlush
  130.             moveq               #2,D0
  131.             dc.w                $AADB
  132.         EndM
  133.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  134.         IMPORT_CFM_FUNCTION CursorDeviceFlush
  135.     ENDIF
  136.  
  137. ;
  138. ; pascal OSErr CursorDeviceButtons(CursorDevicePtr ourDevice, short buttons)
  139. ;
  140.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  141.         Macro
  142.         _CursorDeviceButtons
  143.             moveq               #3,D0
  144.             dc.w                $AADB
  145.         EndM
  146.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  147.         IMPORT_CFM_FUNCTION CursorDeviceButtons
  148.     ENDIF
  149.  
  150. ;
  151. ; pascal OSErr CursorDeviceButtonDown(CursorDevicePtr ourDevice)
  152. ;
  153.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  154.         Macro
  155.         _CursorDeviceButtonDown
  156.             moveq               #4,D0
  157.             dc.w                $AADB
  158.         EndM
  159.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  160.         IMPORT_CFM_FUNCTION CursorDeviceButtonDown
  161.     ENDIF
  162.  
  163. ;
  164. ; pascal OSErr CursorDeviceButtonUp(CursorDevicePtr ourDevice)
  165. ;
  166.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  167.         Macro
  168.         _CursorDeviceButtonUp
  169.             moveq               #5,D0
  170.             dc.w                $AADB
  171.         EndM
  172.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  173.         IMPORT_CFM_FUNCTION CursorDeviceButtonUp
  174.     ENDIF
  175.  
  176. ;
  177. ; pascal OSErr CursorDeviceButtonOp(CursorDevicePtr ourDevice, short buttonNumber, ButtonOpcode opcode, long data)
  178. ;
  179.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  180.         Macro
  181.         _CursorDeviceButtonOp
  182.             moveq               #6,D0
  183.             dc.w                $AADB
  184.         EndM
  185.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  186.         IMPORT_CFM_FUNCTION CursorDeviceButtonOp
  187.     ENDIF
  188.  
  189. ;
  190. ; pascal OSErr CursorDeviceSetButtons(CursorDevicePtr ourDevice, short numberOfButtons)
  191. ;
  192.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  193.         Macro
  194.         _CursorDeviceSetButtons
  195.             moveq               #7,D0
  196.             dc.w                $AADB
  197.         EndM
  198.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  199.         IMPORT_CFM_FUNCTION CursorDeviceSetButtons
  200.     ENDIF
  201.  
  202. ;
  203. ; pascal OSErr CursorDeviceSetAcceleration(CursorDevicePtr ourDevice, Fixed acceleration)
  204. ;
  205.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  206.         Macro
  207.         _CursorDeviceSetAcceleration
  208.             moveq               #8,D0
  209.             dc.w                $AADB
  210.         EndM
  211.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  212.         IMPORT_CFM_FUNCTION CursorDeviceSetAcceleration
  213.     ENDIF
  214.  
  215. ;
  216. ; pascal OSErr CursorDeviceDoubleTime(CursorDevicePtr ourDevice, long durationTicks)
  217. ;
  218.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  219.         Macro
  220.         _CursorDeviceDoubleTime
  221.             moveq               #9,D0
  222.             dc.w                $AADB
  223.         EndM
  224.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  225.         IMPORT_CFM_FUNCTION CursorDeviceDoubleTime
  226.     ENDIF
  227.  
  228. ;
  229. ; pascal OSErr CursorDeviceUnitsPerInch(CursorDevicePtr ourDevice, Fixed resolution)
  230. ;
  231.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  232.         Macro
  233.         _CursorDeviceUnitsPerInch
  234.             moveq               #10,D0
  235.             dc.w                $AADB
  236.         EndM
  237.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  238.         IMPORT_CFM_FUNCTION CursorDeviceUnitsPerInch
  239.     ENDIF
  240.  
  241. ;
  242. ; pascal OSErr CursorDeviceNextDevice(CursorDevicePtr *ourDevice)
  243. ;
  244.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  245.         Macro
  246.         _CursorDeviceNextDevice
  247.             moveq               #11,D0
  248.             dc.w                $AADB
  249.         EndM
  250.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  251.         IMPORT_CFM_FUNCTION CursorDeviceNextDevice
  252.     ENDIF
  253.  
  254. ;
  255. ; pascal OSErr CursorDeviceNewDevice(CursorDevicePtr *ourDevice)
  256. ;
  257.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  258.         Macro
  259.         _CursorDeviceNewDevice
  260.             moveq               #12,D0
  261.             dc.w                $AADB
  262.         EndM
  263.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  264.         IMPORT_CFM_FUNCTION CursorDeviceNewDevice
  265.     ENDIF
  266.  
  267. ;
  268. ; pascal OSErr CursorDeviceDisposeDevice(CursorDevicePtr ourDevice)
  269. ;
  270.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  271.         Macro
  272.         _CursorDeviceDisposeDevice
  273.             moveq               #13,D0
  274.             dc.w                $AADB
  275.         EndM
  276.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  277.         IMPORT_CFM_FUNCTION CursorDeviceDisposeDevice
  278.     ENDIF
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.     ENDIF ; __CURSORDEVICES__ 
  286.  
  287.